package com.clothes.act;


import android.os.Handler;
import android.os.Message;

import com.clothes.R;
import com.clothes.views.pull.PullToRefreshLayout;

import butterknife.Bind;

public class TestActivity extends BaseActivity {

    @Bind(R.id.refresh_view)
    PullToRefreshLayout refreshView;

    @Override
    public void initView() {
        setContentView(R.layout.activity_test);
    }

    @Override
    public void initData() {
        refreshView.setOnPullListener(new PullToRefreshLayout.OnPullListener() {
            @Override
            public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
                // 下拉刷新操作
                new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                        // 千万别忘了告诉控件刷新完毕了哦！
                        refreshView.refreshFinish(PullToRefreshLayout.SUCCEED);
                    }
                }.sendEmptyMessageDelayed(0, 3000);
            }

            @Override
            public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
                // 下拉刷新操作
                new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                        // 千万别忘了告诉控件刷新完毕了哦！
                        refreshView.loadmoreFinish(PullToRefreshLayout.SUCCEED);
                    }
                }.sendEmptyMessageDelayed(0, 3000);
            }
        });
    }

}
